package com.tianji.remark.controller;


import com.tianji.remark.domain.dto.LikeRecordFormDTO;
import com.tianji.remark.service.ILikedRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 点赞记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-03-23
 */
@Slf4j
@RestController
@RequestMapping("/likes")
@Api(tags = "点赞业务相关接口")
@RequiredArgsConstructor
public class LikedRecordController {
    private final ILikedRecordService likedRecordService;
    /*实现点赞功能*/
    @PostMapping
    @ApiOperation("点赞或者取消功能")
    public void addLikeRecord(@Valid @RequestBody LikeRecordFormDTO recordFormDTO){
        likedRecordService.addLikeRecord(recordFormDTO);
    }

    /*查询指定业务id的点赞状态*/
    @GetMapping("/list")
    @ApiOperation("查询指定业务id的点赞状态")
    public Set<Long> isBizLiked(@RequestParam("bizId") List<Long> bizId){
        return likedRecordService.isBizLiked(bizId);
    }

}
